Repository navigation
Give freestanding targets a named entry instead of a C main wrapper - #34
Merged
Merged
Conversation
Anomalous ADR 0049 bridges the generated entry with "a separate narrow assembly shim [that] calls the generated C wrapper with zero arguments and implements only its observed ABI-version, context-begin, context-end and failure hooks". The shape was observed because nothing published one: the entry was always the hosted C `main(int, char **)`, so a target with no C runtime had to recognise a wrapper and invent an argument vector for it. nilassembler --freestanding emits the same entry sequence -- runtime ABI check, context begin, global initialisation, user main, context end -- as `__ny_entry()`, taking no arguments and defining no `main`. Nothing about the sequence changes; only the symbol a caller needs to know and the arguments it no longer has to fabricate. The argc/argv derivation is skipped rather than fed zeroes, so a freestanding object carries no argument-vector code at all. nil.native-symbol-surface now pins both shapes: a hosted object is entered through main, a freestanding one through __ny_entry with no main, and neither widens the import surface beyond the five runtime hooks. Linux: 573 registered, 0 failed, 3 environment skips. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Anomalous ADR 0049 bridges the generated entry with "a separate narrow assembly shim [that] calls the generated C wrapper with zero arguments and implements only its observed ABI-version, context-begin, context-end and failure hooks". The shape was observed because nothing published one: the entry was always the hosted C
main(int, char **), so a target with no C runtime had to recognise a wrapper and invent an argument vector for it.nilassembler --freestanding emits the same entry sequence -- runtime ABI check, context begin, global initialisation, user main, context end -- as
__ny_entry(), taking no arguments and defining nomain. Nothing about the sequence changes; only the symbol a caller needs to know and the arguments it no longer has to fabricate. The argc/argv derivation is skipped rather than fed zeroes, so a freestanding object carries no argument-vector code at all.nil.native-symbol-surface now pins both shapes: a hosted object is entered through main, a freestanding one through __ny_entry with no main, and neither widens the import surface beyond the five runtime hooks.
Linux: 573 registered, 0 failed, 3 environment skips.